<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:71:"/www/wwwroot/mamingwang.cn/yzf/application/admin/view/guanli/index.html";i:1556328198;s:70:"/www/wwwroot/mamingwang.cn/yzf/application/admin/view/common/head.html";i:1556002984;}*/ ?>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>聚财国际</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/public/static/css/font.css"> 
	<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" /> 
    <link rel="stylesheet" href="/public/static/css/xadmin.css">
    <link href="/public/static/lib/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="/public/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/public/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/css">
      #fff{
        border: red solid 1px;
      }
    </script>
  </head>
  
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>管理员列表</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加管理员','<?php echo url('admin/guanli/insert'); ?>')"><i class="layui-icon"></i>添加管理员</button>
    </xblock>
    <table class="layui-table" >
        <thead>
        <tr>
            <th>NO</th>
            <th>昵称</th>
            <th>用户名</th>
            <th>手机号</th>
            <th>状态</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
        <?php if(is_array($guanli) || $guanli instanceof \think\Collection || $guanli instanceof \think\Paginator): $i = 0; $__LIST__ = $guanli;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$guanli): $mod = ($i % 2 );++$i;?>
        <tr>
            <td><?php echo $key+1; ?></td>
            <td><?php echo $guanli['jname']; ?></td>
            <td><?php echo $guanli['gname']; ?></td>
            <td><?php echo $guanli['phone']; ?></td>
            <td><?php if($guanli['state']==1): ?>正常<?php else: ?>冻结<?php endif; ?></td>
            <td class="td-manage">
                <a title="删除" onclick="member_del(this,'<?php echo $guanli['zid']; ?>')" href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>删除
                </a>
                <a title="编辑" onclick="banner_edit(this,'<?php echo $guanli['zid']; ?>')" attr_id='' href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>编辑
                </a>
                <?php if($guanli['state']==1): ?>
                <a title="禁用" onclick="member_jin(this,'<?php echo $guanli['zid']; ?>')" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>禁用
                </a><?php else: ?>
                <a title="启用" onclick="member_qi(this,'<?php echo $guanli['zid']; ?>')" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>启用
                </a><?php endif; ?>
            </td>
        </tr>
        <?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
    <div class="page">
        <div>
        </div>
    </div>

</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

   
    /*管理员-删除*/
    function member_del(obj,id){
        layer.confirm('您确认要删除吗？',function(index){
            //发异步删除数据
			$.ajax({
				url:"<?php echo URL('guanli/delete'); ?>",
				data:{"id":id},
				type:"post",
				dataType:'json',
				success:function(msg){
					if(msg.code==1){
                        layer.msg("删除成功！",{icon: 6},function () {
                            //获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.location.reload();//刷新父级窗口

                        });
                        return false;
					}else{
                        layer.msg("删除失败！",{icon: 6},function () {
                            //获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.location.reload();//刷新父级窗口

                        });
                        return false;
					}
				}
			})
             
        });
    }
    //管理员禁用
    function member_jin(obj,id){
        //发异步删除数据
        $.ajax({
            url:"<?php echo URL('guanli/jin'); ?>",
            data:{"id":id},
            type:"post",
            dataType:'json',
            success:function(msg){
                if(msg==1){
                    layer.msg("已禁用！",{icon: 6},function () {
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口
                    });
                    return false;
                }else{
                    layer.msg("禁用失败！",{icon: 6},function () {
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口
                    });
                    return false;
                }
            }
        })
        return false;
    }
    //管理员禁用
    function member_qi(obj,id){
        //发异步删除数据
        $.ajax({
            url:"<?php echo URL('guanli/jin'); ?>",
            data:{"id":id},
            type:"post",
            dataType:'json',
            success:function(msg){
                if(msg==1){
                    layer.msg("启用成功！",{icon: 6},function () {
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口

                    });
                    return false;
                }else{
                    layer.msg("禁用失败！",{icon: 6},function () {
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口

                    });
                    return false;
                }
            }
        })
    }

    /*管理员-修改*/
	function banner_edit(obj,zid){
				var url="<?php echo URL('guanli/update'); ?>?id="+zid;
				x_admin_show('修改用户',url);
		}

</script>

</body>

</html>